}
$this->groups = $opts->getValue( 'groups' );
+ $this->excludegroups = $opts->getValue( 'excludegroups' );
+ // Backwards-compatibility with old URLs
+ if ( $opts->getValue( 'hidebots' ) ) {
+ $this->excludegroups[] = 'bot';
+ }
+ if ( $opts->getValue( 'hidesysops' ) ) {
+ $this->excludegroups[] = 'sysop';
+ }
}
function getIndexField() {
$tables[] = 'user_groups';
$conds[] = 'ug_user = user_id';
$conds['ug_group'] = $this->groups;
+ $conds[] = 'ug_expiry IS NULL OR ug_expiry >= ' . $dbr->addQuotes( $dbr->timestamp() );
+ }
+ if ( $this->excludegroups !== [] ) {
+ foreach ( $this->excludegroups as $group ) {
+ $conds[] = 'NOT EXISTS (' . $dbr->selectSQLText(
+ 'user_groups', '1', [
+ 'ug_user = user_id',
+ 'ug_group' => $group,
+ 'ug_expiry IS NULL OR ug_expiry >= ' . $dbr->addQuotes( $dbr->timestamp() )
+ ]
+ ) . ')';
+ }
}
if ( !$this->getUser()->isAllowed( 'hideuser' ) ) {
$conds[] = 'NOT EXISTS (' . $dbr->selectSQLText(
$list = [];
$user = User::newFromId( $row->user_id );
- $groups_list = self::getGroups( intval( $row->user_id ), $this->userGroupCache );
- foreach ( $groups_list as $group ) {
- $list[] = self::buildGroupLink( $group, $userName );
+ $ugms = self::getGroupMemberships( intval( $row->user_id ), $this->userGroupCache );
+ foreach ( $ugms as $ugm ) {
+ $list[] = $this->buildGroupLink( $ugm, $userName );
}
$groups = $lang->commaList( $list );